import React from 'react';
import { totalConfig, propName } from 'config/templateConfig';
import { panelPop } from 'views/panelPop';

let latticeConfig = totalConfig.lattice;
let monsterConfig = totalConfig.monster;
export default React.createClass({
    componentDidMount() {
        let opts = this.props.opts, self = this;
        let latticeId = opts.latticeId;
        let latticeInfo = latticeConfig[latticeId];
        let monster = latticeInfo.monster;
    },
    open() {
        panelPop.openPanel('battle');
    },
    getMonster() {
        let opts = this.props.opts, self = this;
        let latticeId = opts.latticeId;
        let latticeInfo = latticeConfig[latticeId];
        let monsterId = latticeInfo.monster;
        return propName[monsterId];
    },
    render() {
        return <div>
            <div className="text-center">{this.getMonster()}</div>
            <div className="flex jc-center"><button onClick={this.open}>战斗</button></div>
        </div>
    }
})